package bookstudytest;

import java.util.ArrayList;
import java.util.Arrays;

/**
 * Created by swordbone on 2017/11/20.
 */
public class ArrayInitTest {

    public static void main(String[] args) {
//        新建一个数组，添加元素，传入方法普通写法
        ArrayList arrayList = new ArrayList();
        arrayList.add("AAA");
        arrayList.add("bbbbb");
        arrayList.add(1232);
        new ArrayInitTest().arrToString(arrayList);
        System.out.println("我是分界线~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
//        双重大括号初始化 MMMMMMMMMMMMMMMMMMMMMMMMMMMMM
        new ArrayInitTest().arrToString(new ArrayList() {{
            add("大哥你好！");
            add("小弟你好！");
        }});

        int[] ints = {1, 2, 2, 3, 3, 3, 3};
        System.out.println(Arrays.toString(ints));


    }

    public void arrToString(ArrayList<String> arrayList) {
        System.out.println(Arrays.toString(arrayList.toArray()));
    }
}
